<template>
	<view class="guide-wrapper">
		<!-- 返回首页 -->
		<uni-bankhome />
		<image class="text" src="https://rsyl.oss-cn-beijing.aliyuncs.com/tgy-text-1.png" mode="widthFix">
		</image>
		<div class="detail">
			拥有推广消费者会员的体验资格， 帮助亲人、朋友消费省钱，可获得 所推广会员年费单次分佣{{money|rateTen|rateTen}}%奖励， 不限人数。
		</div>
		<image class="text" src="https://rsyl.oss-cn-beijing.aliyuncs.com/tgy-text-2.png" mode="widthFix">
		</image>
		<image class="text" src="https://rsyl.oss-cn-beijing.aliyuncs.com/tgy-text-3.png" mode="widthFix">
		</image>
		<image @click="toForm" class="button" src="https://rsyl.oss-cn-beijing.aliyuncs.com/tuiguangyuanguide.png"
			mode="widthFix"></image>
	</view>
</template>

<script>
	import {
		BecomeTuiguangyuan,
		TSRateSetting
	} from "@/api/members.js"
	export default {
		data() {
			return {
				money: 0
			}
		},
		onLoad() {
			TSRateSetting().then((res) => {
				console.log(res)
				let data = res.data.result
				data = data.filter((item) => {
					return item.roleName === '推广员'
				})
				this.money = data[0].membershipRate
			})
		},
		methods: {
			toForm() {
				let that = this;
				wx.showModal({
					title: '成为推广员',
					content: '确定成为推广员？',
					success(res) {
						if (res.confirm) {
							BecomeTuiguangyuan().then((res) => {
								if (res && res.data.success) {
									uni.navigateBack({

									})
								} else {
									uni.showToast({
										title: res.message,
										duration: 2000,
										icon: "none",
									});
								}
							})
						}
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.guide-wrapper {
		height: 100vh;
		background-image: url("https://rsyl.oss-cn-beijing.aliyuncs.com/tuiguangyuanguidebg.png");
		background-size: cover;
		padding: 0 10%;
		box-sizing: border-box;
		text-align: center;

		.text {
			margin-top: 80upx;
			width: 100%;
		}

		.detail {
			margin-top: 80upx;
			border: 2upx solid #fff;
			border-radius: 12upx;
			padding: 24upx;
			color: #ffffff;
			font-size: 38upx;
			text-align: left;
		}

		.button {
			width: 240upx;
		}

	}
</style>
